import Taro , { Component } from '@tarojs/taro';
import { View, Text , Button} from '@tarojs/components';
import './index.scss';

export default class Index extends Component {

   config = {
       navigationBarTitleText: ''
  }

  state = {}

  componentWillMount () {}
  componentDidMount () {}
  componentWillReceiveProps (nextProps,nextContext) {}
  componentWillUnmount () {}
  componentDidShow () {}
  componentDidHide () {}
  componentDidCatchError () {}
  componentDidNotFound () {}

  cancle() {
    this.props['cancleCb']()
  }

  confirm() {
    this.props['confirmCb']()
  }

  render() {
    const { title = '默认标题', confirmText = '确认', cancleText = '取消', contentArr = []} = this.props
    return (
      <View className="modal">
        <View className="mask"></View>
        <View className="wrapper">
          <View className="title">{title}</View>
          {contentArr.map(content => <View className="value" key={content.key}>
            {content.key}: {content.value}
          </View>
          )}
          <View className="btn-wrapper">
            <View className="btn" onClick={this.cancle}>{cancleText}</View>
            <View className="btn" onClick={this.confirm}>{confirmText}</View>
          </View>
        </View>
      </View>
    );
  }
}
